varying float fogcoord;

void main()
{
   gl_TexCoord[0] = gl_MultiTexCoord0;
   fogcoord = abs( (gl_ModelViewMatrix * gl_Vertex).z );

   gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
}